﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>会员徽章配置</title>
    <script src="/Scripts/site/bgmgr/badgecfg/index.js" type="text/javascript"></script>
</head>
<body>
    <ext:ResourceManager runat="server" />
    <ext:Viewport runat="server" Layout="fit">
        <Items>
            <ext:GridPanel ID="GridPanel1" runat="server" StripeRows="true" TrackMouseOver="true">
                <Store>
                    <ext:Store runat="server">
                        <Proxy>
                            <ext:HttpProxy Url="/BgMgr/BadgeConfig/GetAllBadge" />
                        </Proxy>
                        <BaseParams>
                            <ext:Parameter Name="limit" Value="30" Mode="Value" />
                            <ext:Parameter Name="start" Value="0" Mode="Value" />
                        </BaseParams>
                        <Reader>
                            <ext:JsonReader IDProperty="BID" Root="data" TotalProperty="total">
                                <Fields>
                                    <ext:RecordField Name="BID" />
                                    <ext:RecordField Name="BadgeName" />
                                    <ext:RecordField Name="BadgeImage" />
                                    <ext:RecordField Name="BadgeDes" />
                                    <ext:RecordField Name="CheckMethod" />
                                    <ext:RecordField Name="CheckParam" />
                                    <ext:RecordField Name="CreateTime" Type="Date" />
                                    <ext:RecordField Name="AwardCents" Type="Int" />
                                    <ext:RecordField Name="AwardExperience" Type="Int" />
                                    <ext:RecordField Name="Sort" Type="Int" />
                                    <ext:RecordField Name="IsShow" Type="Int" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                        <SortInfo Field="BID" Direction="ASC" />
                    </ext:Store>
                </Store>
                <TopBar>
                    <ext:Toolbar runat="server">
                        <Items>
                            <ext:Button runat="server" Text="新建" Icon="Add">
                                <Listeners>
                                    <Click Handler="#{NewBadgeWnd}.show()" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <LoadMask ShowMask="true" Msg="列表加载中,请稍后..." />
                <ColumnModel runat="server">
                    <Columns>
                        <ext:CommandColumn Width="25" Hideable="true">
                            <Commands>
                                <ext:GridCommand CommandName="edit" Icon="ApplicationFormEdit">
                                    <ToolTip Text="编辑" />
                                </ext:GridCommand>
                            </Commands>
                            <PrepareToolbar Handler="toolbar.setVisible(!record.newRecord);" />
                        </ext:CommandColumn>
                        <ext:CommandColumn Width="25" Hideable="true">
                            <Commands>
                                <ext:GridCommand CommandName="delete" Icon="Cross">
                                    <ToolTip Text="删除" />
                                </ext:GridCommand>
                            </Commands>
                            <PrepareToolbar Handler="toolbar.setVisible(!record.newRecord);" />
                        </ext:CommandColumn>
                        <ext:Column Header="BID" DataIndex="BID" />
                        <ext:Column Header="徽章名称" DataIndex="BadgeName" />
                        <ext:Column Header="徽章图案" DataIndex="BadgeImage" />
                        <ext:Column Header="徽章描述" DataIndex="BadgeDes" />
                        <ext:Column Header="检查方法" DataIndex="CheckMethod" />
                        <ext:Column Header="检查参数" DataIndex="CheckParam" />
                        <ext:DateColumn Header="创建时间" DataIndex="CreateTime" Format="yyyy-MM-dd hh:mm:ss" />
                        <ext:Column Header="奖励积分" DataIndex="AwardCents" />
                        <ext:Column Header="奖励成长值" DataIndex="AwardExperience" />
                        <ext:Column Header="排序" DataIndex="Sort" />
                        <ext:Column Header="是否显示" DataIndex="IsShow" />
                    </Columns>
                </ColumnModel>
                <Listeners>
                    <Command Fn="rowcmd" />
                </Listeners>
                <SelectionModel>
                    <ext:RowSelectionModel runat="server" SingleSelect="true" />
                </SelectionModel>
                <BottomBar>
                    <ext:PagingToolbar runat="server" PageSize="30"  />
                </BottomBar>
            </ext:GridPanel>
        </Items>
    </ext:Viewport>

    <ext:Window ID="NewBadgeWnd" runat="server" Title="新建徽章" Hidden="true" Modal="true" Icon="Add" Width="500" Height="470">
        <AutoLoad Url="/BgMgr/BadgeConfig/Create" Mode="IFrame" TriggerEvent="show"
            ReloadOnEvent="true" ShowMask="true" MaskMsg="正在加载数据..." />
        <Buttons>
            <ext:Button runat="server" Text="关闭">
                <Listeners>
                    <Click Handler="#{NewBadgeWnd}.hide();" />
                </Listeners>
            </ext:Button>
        </Buttons>
        <Listeners>
            <Hide Handler="if (this.iframe.dom.contentWindow.recordChanged) { GridPanel1.store.reload(); };" />
        </Listeners>
    </ext:Window>

    <ext:Window ID="EditBadgeWnd" runat="server" Title="修改徽章" Hidden="true" Modal="true" Icon="Add" Width="500" Height="470">
        <AutoLoad Url="/BgMgr/BadgeConfig/Edit" Mode="IFrame" TriggerEvent="show"
            ReloadOnEvent="true" ShowMask="true" MaskMsg="正在加载数据...">
            <Params>
                <ext:Parameter Name="bid" Mode="Value" />
            </Params>
        </AutoLoad>
        <Buttons>
            <ext:Button ID="Button1" runat="server" Text="关闭">
                <Listeners>
                    <Click Handler="#{EditBadgeWnd}.hide();" />
                </Listeners>
            </ext:Button>
        </Buttons>
        <Listeners>
            <Hide Handler="if (this.iframe.dom.contentWindow.recordChanged) { GridPanel1.store.reload(); };" />
        </Listeners>
    </ext:Window>
</body>
</html>
